﻿@model IEnumerable<AspNetExpressInformationManageSystem.Models.ExpressGoods>

@{
    ViewBag.Title = "货运单列表";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>货运单列表</h2>

<div class="row">
    <div class="col-lg-12">
        @using (Html.BeginForm("Search", "ExpressGoods", FormMethod.Post, new { @class = "form-inline" }))
        {
            @Html.AntiForgeryToken()
            <div class="input-group">
                <span class="input-group-addon">编号:</span> @Html.TextBox("ID", "", new { @class = "form-control", @type = "number" })
                <span class="input-group-addon">日期:</span> @Html.TextBox("Date", "", new { @class = "form-control", @type = "date" })
                <span class="input-group-addon">邮编:</span> @Html.TextBox("ZipCode", "", new { @class = "form-control", @type = "number" })
                <span class="input-group-btn"><button class="btn btn-default" type="submit">查找</button></span>
            </div>
        }
    </div>
</div>
<div class="table-responsive">
    <table class="table">
        <tr>
            <th>选择</th>
            <th>
                @Html.DisplayNameFor(model => model.ID)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.SenderName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.SenderTel)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.SenderAddr)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.SenderZipCode)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ReceiverName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ReceiverTel)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ReceiverAddr)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ReceiverZipCode)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Weight)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Size)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Cost)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Remark)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Status)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Date)
            </th>
            <th>操作</th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.CheckBox("select", new { @id = item.ID })
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ID)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.SenderName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.SenderTel)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.SenderAddr)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.SenderZipCode)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ReceiverName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ReceiverTel)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ReceiverAddr)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ReceiverZipCode)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Weight)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Size)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Cost)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Remark)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Status)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Date)
                </td>
                <td>
                    @Html.ActionLink("编辑", "Edit", new { id = item.ID }) |
                    @Html.ActionLink("查看", "Details", new { id = item.ID }) |
                    @Html.ActionLink("删除", "Delete", new { id = item.ID })
                </td>
            </tr>
        }

    </table>
</div>
<div class="row">
    <div class="col-sm-6 col-lg-6">
        @using (Html.BeginForm("Create", "ExpressGoodsStorages", FormMethod.Get, new { @class = "form-inlined" }))
            {
            <div class="input-group">
                <span class="input-group-addon">入库编号:</span>@Html.TextBox("GoodsStorageID", "", new { @id = "storage", @class = "form-control", @type = "text", @readonly = "readonly" })
                <span class="input-group-btn"><button class="btn btn-danger" type="submit">入库</button></span>
            </div>
        }
    </div>
</div>
@section scripts {
    <script>
        var checkboxs = $('input[name="select"][type="checkbox"]');
        checkboxs.click(function () {
            var selectedId = [];
            checkboxs.each(function (index, checkbox) {
                var checkbox = $(checkbox);
                if (checkbox.prop('checked')) {
                    selectedId.push(checkbox.attr('id'));
                }
            });
            $('#storage').val(selectedId.join());
        });
    </script>
}

